package com.rc.saas.mini.service.order;

import com.github.pagehelper.PageInfo;
import com.rc.saas.mini.common.base.BaseService;
import com.rc.saas.mini.mapper.order.OrderInfoMapper;
import com.rc.saas.mini.model.member.MemberInfo;
import com.rc.saas.mini.model.order.OrderInfo;
import com.rc.saas.mini.model.order.OrderInfoExample;
import com.rc.saas.mini.model.rc.RcEvaluate;
import com.rc.saas.mini.vo.invoice.ElecInvoiceVo;
import com.rc.saas.mini.vo.order.OrderInfoVo;
import com.rc.saas.mini.vo.order.OrderStatisticsVo;
import com.rc.saas.mini.vo.rc.RcWithEvaluateVo;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author wangzhengwei
 * @create 2021/12/16
 */
public interface OrderInfoService extends BaseService<Long, OrderInfo, OrderInfoExample, OrderInfoMapper> {
    OrderStatisticsVo countOrderByYearMonth(MemberInfo member, String yearMonth);

    OrderInfo selectLastByMember(Long memberId, String tenantCode);

    Long countElecOrder(Long memberId, String tenantCode);

    List<OrderInfoVo> listOrderByYearMonth(MemberInfo member, String yearMonth, String accountType, String carNumes, String status);

    PageInfo<String> listPageYearMonthByMemberId(Long memberId, String accountType, String carNumes, Integer pageNo, Integer pageSize, String status);

    OrderInfo selectOrderByGunIdAndMember(Long gunId, Long memberId, String tenantCode);

    List<OrderInfo> listPageOrder(Integer pageNo, Integer pageSize, Long memberId, String startDate, String endDate, String carNum, String memberType);

    OrderInfo selectOrderByOutOrderNum(String outOrderNum, String tenantCode);

    OrderInfo selectOrderByOutOrderNum(String outOrderNum);

    OrderInfo selectOrderByOrderNum(String orderNum);

    OrderInfoVo selectOrderById(Long orderId);

    List<OrderInfo> listChargingOrder(Long memberId, Integer hours, String tenantCode);

    /**
     * 匹配用户正在充电的订单
     */
    List<OrderInfo> listElecOrder(MemberInfo member, int hours);

    /**
     * 用户未开票已完成充电的订单
     */
    PageInfo<OrderInfoVo> listPageOrderWithoutInvoice(Long memberId, Integer pageNo, Integer pageSize);

    /**
     * 统计发票订单
     */
    ElecInvoiceVo countInvoiceByOrder(@Param("selfOrderIds") List<Long> selfOrderIds, @Param("tenantCode") String tenantCode);

    List<String> listEntOrderDateWithoutInvoice(MemberInfo memberInfo);

    /** 未开票订单 */
    PageInfo<OrderInfoVo> listPageEntOrderWithoutInvoiceByMember(MemberInfo member, String yearMonth, Integer pageNo, Integer pageSize);

    /** 未开票订单实付合算 */
    BigDecimal countEntOrderWithoutInvoiceAmountByMember(MemberInfo member, String yearMonth);

    List<String> listOrderDateWithInvoice(MemberInfo member, Long invoiceApplyId);

    /** 已开票订单 */
    PageInfo<OrderInfoVo> listPageOrderWithInvovice(MemberInfo member, String yearMonth, Long invoiceApplyId, Integer pageNo, Integer pageSize);

    /** 最近产生订单(100条内)*/
    List<OrderInfo> listOrderRecently(Long memberId);

    /**未评论订单
     *
     * @param rcEvaluate
     * @return
     */
    List<OrderInfoVo> listPageByRcEvaluateWithOrder(Long memberId);

    /**已评论订单
     *
     * @param rcEvaluate
     * @return
     */
    List<OrderInfoVo> listByRcWithEvaluateVo(Long memberId);

    List<OrderInfo> listFinishOrder(Long memberId);

    OrderInfo selectByNotEnd(Long memberId);

    List<OrderInfo> listByInvoice(List<Long> ids, Long memberId);
}
